<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
    class m_transaksi_kasir extends CI_Model
{
    function __construct()
    {
        parent::__construct();
    }

    public function get_total_penjualan($where = null, $limit = null, $offset = null)
    {
        $this->db->select('sum(TOTAL) as total');
        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        return $this->db->get("transaksi_kasir");
    }

    public function get($where = null, $limit = null, $offset = null)
    {
        $this->db->select('detail_transaksi_kasir.*');
        $this->db->select('transaksi_kasir.ID_TRANSAKSI_KASIR');
        $this->db->select('date(transaksi_kasir.TGL_TRANSAKSI) as TGL_TRANSAKSI');
        $this->db->select('barang.ID_BARANG');
        $this->db->select('barang.NAMA_BARANG');
        $this->db->select('barang.HARGA_JUAL');
        $this->db->select('barang.NAMA_SATUAN');
        $this->db->join('transaksi_kasir', 'detail_transaksi_kasir.ID_TRANSAKSI_KASIR = transaksi_kasir.ID_TRANSAKSI_KASIR');
        $this->db->join('barang', 'detail_transaksi_kasir.ID_BARANG = barang.ID_BARANG');

        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        return $this->db->get("detail_transaksi_kasir");
    }
}
?>
